<!DOCTYPE html>
<html class="client-nojs vector-feature-night-mode-disabled vector-feature-language-in-header-enabled vector-feature-language-in-main-page-header-disabled vector-feature-page-tools-pinned-disabled vector-feature-toc-pinned-clientpref-1 vector-feature-main-menu-pinned-disabled vector-feature-limited-width-clientpref-1 vector-feature-limited-width-content-enabled vector-feature-custom-font-size-clientpref-1 vector-feature-appearance-pinned-clientpref-1 vector-sticky-header-enabled" lang="en" dir="ltr"><head>
<meta charset="UTF-8">
<title>Interprocedural optimization</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="canonical" href="https://en.wikipedia.org/wiki/Interprocedural_optimization"> <link href="./mw/ext.cite.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/ext.pygments.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.icons.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.search.codex.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/skins.vector.styles.css" rel="stylesheet" type="text/css">
<link href="./mw/user.styles.css" rel="stylesheet" type="text/css">
<meta name="ResourceLoaderDynamicStyles" content="">
<link rel="stylesheet" type="text/css" href="./mw/site.styles.css">
<link rel="stylesheet" type="text/css" href="./mw/noscript.css">
<link rel="stylesheet" type="text/css" href="./footer.css">
<link rel="stylesheet" type="text/css" href="./vector-2022.css">
</head>
<body class="skin--responsive skin-vector skin-vector-search-vue mediawiki ltr sitedir-ltr mw-hide-empty-elt ns-0 ns-subject page-Interprocedural_optimization rootpage-Interprocedural_optimization skin-vector-2022 action-view">
<div class="mw-page-container">
<div class="mw-page-container-inner">
<div class="mw-content-container">
<main id="content" class="mw-body">
<header class="mw-body-header vector-page-titlebar">
<h1 id="firstHeading" class="firstHeading mw-first-heading">
<span id="openzim-page-title" class="mw-page-title-main"><span class="mw-page-title-main">Interprocedural optimization</span></span>
</h1>
</header>
<a id="top"></a>
<div id="bodyContent" class="vector-body ve-init-mw-desktopArticleTarget-targetContainer" aria-labelledby="firstHeading" data-mw-ve-target-container="">
<div id="mw-content-text" class="mw-body-content mw-content-ltr" lang="en" dir="ltr"><div class="mw-content-ltr mw-parser-output" lang="en" dir="ltr">
<p><b>Interprocedural optimization</b> (<b>IPO</b>) is a collection of <a href="Compiler" title="Compiler">compiler</a> techniques used in <a href="Computer_programming" title="Computer programming">computer programming</a> to improve performance in programs containing many frequently used <a href="Function_(computer_science)" class="mw-redirect" title="Function (computer science)">functions</a> of small or medium length. IPO differs from other <a href="Compiler_optimizations" class="mw-redirect" title="Compiler optimizations">compiler optimizations</a> by analyzing the entire program as opposed to a single function or block of code.
</p><p>IPO seeks to reduce or eliminate duplicate calculations and inefficient use of memory and to simplify iterative sequences such as loops. If a call to another routine occurs within a loop, IPO analysis may determine that it is best to <a href="Inline_expansion" title="Inline expansion">inline</a> that routine. Additionally, IPO may re-order the routines for better memory layout and <a href="Memory_locality" class="mw-redirect" title="Memory locality">locality</a>.
</p><p>IPO may also include typical compiler optimizations applied on a whole-program level, for example, <a href="Dead_code_elimination" class="mw-redirect" title="Dead code elimination">dead code elimination</a> (DCE), which removes code that is never executed. IPO also tries to ensure better use of constants. Modern compilers offer IPO as an option at compile-time. The actual IPO process may occur at any step between the human-readable source code and producing a finished executable binary program.
</p><p>For languages that compile on a file-by-file basis, effective IPO across <a href="Translation_unit_(programming)" title="Translation unit (programming)">translation units</a> (module files) requires knowledge of the "entry points" of the program so that a <b>whole program optimization</b> (<b>WPO</b>) can be run. In many cases, this is implemented as a <b>link-time optimization</b> (<b>LTO</b>) pass, because the whole program is visible to the linker.
</p>
<meta property="mw:PageProp/toc">
<div class="mw-heading mw-heading2"><h2 id="Analysis">Analysis</h2></div>
<p>The objective of any optimization for speed is to have the program run as swiftly as possible; the problem is that it is not possible for a compiler to correctly analyze a program and determine what it <i>will</i> do, much less what the programmer <i>intended</i> for it to do. By contrast, human programmers start at the other end with a purpose and attempt to produce a program that will achieve it, preferably without expending a lot of thought in the process.
</p><p>For various reasons, including readability, programs are frequently broken up into a number of procedures that handle a few general cases. However, the generality of each procedure may result in wasted effort in specific usages. Interprocedural optimization represents an attempt at reducing this waste.
</p><p>Suppose there is a procedure that evaluates F(x), and that F is a <a href="Pure_function" title="Pure function">pure function</a>, and the code requests the result of F(6) and then later, F(6) again. This second evaluation is almost certainly unnecessary: the result could have instead been saved and referred to later. This simple optimization is foiled the moment that the implementation of F(x) becomes impure; that is, its execution involves references to parameters other than the explicit argument 6 that has been changed between the invocations, or side effects such as printing some message to a log, counting the number of evaluations, accumulating the <a href="Central_processing_unit" title="Central processing unit">CPU</a> time consumed, preparing internal tables so that subsequent invocations for related parameters will be facilitated, and so forth. Losing these side effects via non-evaluation a second time may be acceptable, or they may not.
</p><p>More generally, aside from optimization, the second reason to use procedures is to avoid duplication of code that would produce the same results, or almost the same results, each time the procedure is performed. A general approach to optimization would therefore be to reverse this: some or all invocations of a certain procedure are replaced by the respective code, with the parameters appropriately substituted. The compiler will then try to optimize the result.
</p>
<div class="mw-heading mw-heading2"><h2 id="WPO_and_LTO">WPO and LTO</h2></div>
<p><b>Whole program optimization</b> (<b>WPO</b>) is the compiler optimization of a program using information about all the <a href="Module_(programming)" class="mw-redirect" title="Module (programming)">modules</a> in the program. Normally, optimizations are performed on a <a href="Translation_unit_(programming)" title="Translation unit (programming)">per module, "compiland", basis</a>; but this approach, while easier to write and test and less demanding of resources during the compilation itself, does not allow certainty about the safety of a number of optimizations such as aggressive <a href="Inline_expansion" title="Inline expansion">inlining</a> and thus cannot perform them even if they would actually turn out to be efficiency gains that do not change the <a href="Semantics" title="Semantics">semantics</a> of the emitted object code.
</p><p><b>Link-time optimization</b> (<b>LTO</b>) is a type of program optimization performed by a compiler to a program at <a href="Link_time" title="Link time">link time</a>. Link time optimization is relevant in programming languages that compile programs on a file-by-file basis, and then link those files together (such as <a href="C_(programming_language)" title="C (programming language)">C</a> and <a href="Fortran" title="Fortran">Fortran</a>), rather than all at once (such as <a href="Java_(programming_language)" title="Java (programming language)">Java</a>'s <a href="Just-in-time_compilation" title="Just-in-time compilation">just-in-time compilation</a> (JIT)).
</p><p>Once all files have been compiled separately into <a href="Object_file" title="Object file">object files</a>, traditionally, a compiler links (merges) the object files into a single file, the <a href="Executable" title="Executable">executable</a>. However, in LTO as implemented by the <a href="GNU_Compiler_Collection" title="GNU Compiler Collection">GNU Compiler Collection</a> (GCC) and <a href="LLVM" title="LLVM">LLVM</a>, the compiler is able to dump its <a href="Intermediate_representation" title="Intermediate representation">intermediate representation</a> (IR), i.e. <a href="GIMPLE" class="mw-redirect" title="GIMPLE">GIMPLE</a> bytecode or LLVM bitcode, respectively, so that all the different compilation units that will go to make up a single executable can be optimized as a single module when the link finally happens. This expands the scope of interprocedural optimizations to encompass the whole program (or, rather, everything that is visible at link time). With link-time optimization, the compiler can apply various forms of interprocedural optimization to the whole program, allowing for deeper analysis, more optimization, and ultimately better program performance.
</p><p>In practice, LTO does not always optimize the entire program—<a href="Library_(computing)" title="Library (computing)">library functions</a>, especially <a href="Dynamic_linker" title="Dynamic linker">dynamically linked</a> shared objects, are intentionally kept out to avoid excessive duplication and to allow for updating. <a href="Static_library" title="Static library">Static linking</a> does naturally lend to the concept of LTO, but it only works with library archives that contain IR objects as opposed to machine-code only object files.<sup id="cite_ref-gcc-lto_1-0" class="reference"><a href="#cite_note-gcc-lto-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> Due to performance concerns, not even the entire unit is always directly used—a program could be partitioned in a divide-and-conquer style LTO such as GCC's WHOPR.<sup id="cite_ref-gcc-lto-int_2-0" class="reference"><a href="#cite_note-gcc-lto-int-2"><span class="cite-bracket">[</span>2<span class="cite-bracket">]</span></a></sup> And of course, when the program being built is itself a library, the optimization would keep every externally-available (exported) symbol, without trying too hard at removing them as a part of DCE.<sup id="cite_ref-gcc-lto_1-1" class="reference"><a href="#cite_note-gcc-lto-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
</p><p>A much more limited form of WPO is still possible without LTO, as exemplified by GCC's <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">-fwhole-program</code> switch. This mode makes GCC assume that the module being compiled contains the <a href="Entry_point" title="Entry point">entry point</a> of the entire program, so that every other function in it is not externally used and can be safely optimized away. Since it only applies to a single module, it cannot truly encompass the whole program. It can be combined with LTO in the one-big-module sense, which is useful when the linker is not communicating back to GCC about what entry points or symbols are being used externally.<sup id="cite_ref-gcc-lto_1-2" class="reference"><a href="#cite_note-gcc-lto-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="History">History</h2></div>
<p>For <a href="Procedural_language" class="mw-redirect" title="Procedural language">procedural languages</a> like <a href="ALGOL" title="ALGOL">ALGOL</a>, interprocedural analysis and optimization appear to have entered commercial practice in the early 1970s. IBM's <a href="PL/I" title="PL/I">PL/I</a> Optimizing Compiler performed interprocedural analysis to understand the side effects of both procedure calls and exceptions (cast, in PL/I terms as "on conditions")<sup id="cite_ref-3" class="reference"><a href="#cite_note-3"><span class="cite-bracket">[</span>3<span class="cite-bracket">]</span></a></sup> and in papers by <a href="Frances_E._Allen" class="mw-redirect" title="Frances E. Allen">Fran Allen</a>.<sup id="cite_ref-4" class="reference"><a href="#cite_note-4"><span class="cite-bracket">[</span>4<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-5" class="reference"><a href="#cite_note-5"><span class="cite-bracket">[</span>5<span class="cite-bracket">]</span></a></sup> Work on compilation of the <a href="APL_(programming_language)" title="APL (programming language)">APL</a> programming language was necessarily interprocedural.<sup id="cite_ref-6" class="reference"><a href="#cite_note-6"><span class="cite-bracket">[</span>6<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-7" class="reference"><a href="#cite_note-7"><span class="cite-bracket">[</span>7<span class="cite-bracket">]</span></a></sup>
</p><p>The techniques of interprocedural analysis and optimization were the subject of academic research in the 1980s and 1990s. They re-emerged into the commercial compiler world in the early 1990s with compilers from both <a href="Convex_Computer_Corporation" class="mw-redirect" title="Convex Computer Corporation">Convex Computer Corporation</a> (the "Application Compiler" for the Convex C4) and from Ardent (the compiler for the <a href="Ardent_Titan" class="mw-redirect" title="Ardent Titan">Ardent Titan</a>). These compilers demonstrated that the technologies could be made sufficiently fast to be acceptable in a commercial compiler; subsequently interprocedural techniques have appeared in a number of commercial and non-commercial systems.
</p>
<div class="mw-heading mw-heading2"><h2 id="Flags_and_implementation">Flags and implementation</h2></div>
<div class="mw-heading mw-heading3"><h3 id="Unix-like">Unix-like</h3></div>
<p>The <a href="GNU_Compiler_Collection" title="GNU Compiler Collection">GNU Compiler Collection</a> has function inlining at all optimization levels. At <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">-O1</code> this only applies to those only called once (<code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">-finline-functions-once</code>), at <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">-O2</code> this constraint is relaxed (<code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">-finline-functions</code>). By default this is a single-file-only behavior, but with link-time optimization <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">-flto</code> it becomes whole program.<sup id="cite_ref-gcc-lto_1-3" class="reference"><a href="#cite_note-gcc-lto-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup> <a href="Clang" title="Clang">Clang</a>'s command-line interface is similar to that of GCC, with the exception that there is no <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">-fwhole-program</code> option.<sup id="cite_ref-8" class="reference"><a href="#cite_note-8"><span class="cite-bracket">[</span>8<span class="cite-bracket">]</span></a></sup>
</p><p>Object files produced by LTO contain a compiler-specific <a href="Intermediate_representation" title="Intermediate representation">intermediate representation</a> (IR) that is interpreted at link-time. To make sure this plays well with <a href="Static_libraries" class="mw-redirect" title="Static libraries">static libraries</a>, newer <a href="GNU_linker" class="mw-redirect" title="GNU linker">GNU linkers</a> have a "linker plugin" interface that allows the compiler to convert the object files into a machine code form when needed. This plugin also helps drive the LTO process in general. Alternatively, a "fat LTO" object can be produced to contain both machine code and the IR, but this takes more space.<sup id="cite_ref-gcc-lto_1-4" class="reference"><a href="#cite_note-gcc-lto-1"><span class="cite-bracket">[</span>1<span class="cite-bracket">]</span></a></sup>
</p><p>Since both GCC and LLVM (clang) are able produce an IR from a variety of programming languages, link-time IPO can happen even across language boundaries. This is most commonly demonstrated with C and C++,<sup id="cite_ref-9" class="reference"><a href="#cite_note-9"><span class="cite-bracket">[</span>9<span class="cite-bracket">]</span></a></sup> but LLVM makes it possible for <a href="Rust_(programming_language)" title="Rust (programming language)">Rust</a> and all other LLVM-based compilers too.<sup id="cite_ref-10" class="reference"><a href="#cite_note-10"><span class="cite-bracket">[</span>10<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading4"><h4 id="Non-LTO_options">Non-LTO options</h4></div>
<p>GCC and Clang perform IPO by default at optimization level 2. However, the degree of optimization is limited when LTO is disabled, as IPO can only happen within an object file and non-<a href="Static_(keyword)" title="Static (keyword)">static</a> functions can never be eliminated. The latter problem has a non-LTO solution: the <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">-fwhole-program</code> switch can be used to assume that only <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">main()</code> is non-static, i.e. visible from the outside.<sup id="cite_ref-11" class="reference"><a href="#cite_note-11"><span class="cite-bracket">[</span>11<span class="cite-bracket">]</span></a></sup>
</p><p>Another non-LTO technique is "function sections" (<code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">-ffunction-sections</code> in GCC and Clang). By placing each function into its own section in the object file, the linker can perform dead code removal without an IR by removing unreferenced sections (using the linker option <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">--gc-sections</code>).<sup id="cite_ref-12" class="reference"><a href="#cite_note-12"><span class="cite-bracket">[</span>12<span class="cite-bracket">]</span></a></sup> A similar option is available for variables, but it causes much worse code to be produced.
</p>
<div class="mw-heading mw-heading3"><h3 id="Other">Other</h3></div>
<p>The <a href="Intel_C%2B%2B_Compiler" title="Intel C++ Compiler">Intel C/C++ compilers</a> allow whole-program IPO. The flag to enable interprocedural optimizations for a single file is <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">-ip</code>, the flag to enable interprocedural optimization across all files in the program is <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">-ipo</code>.<sup id="cite_ref-13" class="reference"><a href="#cite_note-13"><span class="cite-bracket">[</span>13<span class="cite-bracket">]</span></a></sup><sup id="cite_ref-14" class="reference"><a href="#cite_note-14"><span class="cite-bracket">[</span>14<span class="cite-bracket">]</span></a></sup>
</p><p>The <a href="Microsoft_Visual_C%2B%2B" title="Microsoft Visual C++">MSVC compiler</a>, integrated into Visual Studio, also supports interprocedural optimization on the whole program.<sup id="cite_ref-MSVC_GL_2019_15-0" class="reference"><a href="#cite_note-MSVC_GL_2019-15"><span class="cite-bracket">[</span>15<span class="cite-bracket">]</span></a></sup>
</p><p>A compiler-independent interface for enabling whole-program interprocedural optimizations is via the <code class="mw-highlight mw-highlight-lang-text mw-content-ltr" style="" dir="ltr">INTERPROCEDURAL_OPTIMIZATION</code> property in <a href="CMake" title="CMake">CMake</a>.<sup id="cite_ref-16" class="reference"><a href="#cite_note-16"><span class="cite-bracket">[</span>16<span class="cite-bracket">]</span></a></sup>
</p>
<div class="mw-heading mw-heading2"><h2 id="See_also">See also</h2></div>
<ul><li><a href="Profile-guided_optimization" title="Profile-guided optimization">Profile-guided optimization</a> (PGO)</li>
<li><a href="Single_compilation_unit" title="Single compilation unit">Single compilation unit</a></li></ul>
<div class="mw-heading mw-heading2"><h2 id="References">References</h2></div>
<style data-mw-deduplicate="TemplateStyles:r1239543626">
/* start https://en.wikipedia.org/ */
.mw-parser-output .reflist{margin-bottom:0.5em;list-style-type:decimal}@media screen{.mw-parser-output .reflist{font-size:90%}}.mw-parser-output .reflist .references{font-size:100%;margin-bottom:0;list-style-type:inherit}.mw-parser-output .reflist-columns-2{column-width:30em}.mw-parser-output .reflist-columns-3{column-width:25em}.mw-parser-output .reflist-columns{margin-top:0.3em}.mw-parser-output .reflist-columns ol{margin-top:0}.mw-parser-output .reflist-columns li{page-break-inside:avoid;break-inside:avoid-column}.mw-parser-output .reflist-upper-alpha{list-style-type:upper-alpha}.mw-parser-output .reflist-upper-roman{list-style-type:upper-roman}.mw-parser-output .reflist-lower-alpha{list-style-type:lower-alpha}.mw-parser-output .reflist-lower-greek{list-style-type:lower-greek}.mw-parser-output .reflist-lower-roman{list-style-type:lower-roman}
/* end https://en.wikipedia.org/ */
</style><div class="reflist reflist-columns references-column-width" style="column-width: 30em;">
<ol class="references">
<li id="cite_note-gcc-lto-1"><span class="mw-cite-backlink">^ <a href="#cite_ref-gcc-lto_1-0"><sup><i><b>a</b></i></sup></a> <a href="#cite_ref-gcc-lto_1-1"><sup><i><b>b</b></i></sup></a> <a href="#cite_ref-gcc-lto_1-2"><sup><i><b>c</b></i></sup></a> <a href="#cite_ref-gcc-lto_1-3"><sup><i><b>d</b></i></sup></a> <a href="#cite_ref-gcc-lto_1-4"><sup><i><b>e</b></i></sup></a></span> <span class="reference-text"><style data-mw-deduplicate="TemplateStyles:r1238218222">
/* start https://en.wikipedia.org/ */
.mw-parser-output cite.citation{font-style:inherit;word-wrap:break-word}.mw-parser-output .citation q{quotes:"\"""\"""'""'"}.mw-parser-output .citation:target{background-color:rgba(0,127,255,0.133)}.mw-parser-output .id-lock-free.id-lock-free a{background:url("./mw/Lock-green.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-limited.id-lock-limited a,.mw-parser-output .id-lock-registration.id-lock-registration a{background:url("./mw/Lock-gray-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .id-lock-subscription.id-lock-subscription a{background:url("./mw/Lock-red-alt-2.svg")right 0.1em center/9px no-repeat}.mw-parser-output .cs1-ws-icon a{background:url("./mw/Wikisource-logo.svg")right 0.1em center/12px no-repeat}body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-free a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-limited a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-registration a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .id-lock-subscription a,body:not(.skin-timeless):not(.skin-minerva) .mw-parser-output .cs1-ws-icon a{background-size:contain;padding:0 1em 0 0}.mw-parser-output .cs1-code{color:inherit;background:inherit;border:none;padding:inherit}.mw-parser-output .cs1-hidden-error{display:none;color:var(--color-error,#d33)}.mw-parser-output .cs1-visible-error{color:var(--color-error,#d33)}.mw-parser-output .cs1-maint{display:none;color:#085;margin-left:0.3em}.mw-parser-output .cs1-kern-left{padding-left:0.2em}.mw-parser-output .cs1-kern-right{padding-right:0.2em}.mw-parser-output .citation .mw-selflink{font-weight:inherit}@media screen{.mw-parser-output .cs1-format{font-size:95%}html.skin-theme-clientpref-night .mw-parser-output .cs1-maint{color:#18911f}}@media screen and (prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .cs1-maint{color:#18911f}}
/* end https://en.wikipedia.org/ */
</style><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html">"Optimize Options"</a>. <i>Using the GNU Compiler Collection (GCC)</i>. <q>Link-time optimizations do not require the presence of the whole program to operate. If the program does not require any symbols to be exported, it is possible to combine -flto and -fwhole-program to allow the interprocedural optimizers to use more aggressive assumptions which may lead to improved optimization opportunities. Use of -fwhole-program is not needed when linker plugin is active (see -fuse-linker-plugin).</q></cite></span>
</li>
<li id="cite_note-gcc-lto-int-2"><span class="mw-cite-backlink"><b><a href="#cite_ref-gcc-lto-int_2-0">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://gcc.gnu.org/onlinedocs/gccint/LTO-Overview.html">"LTO Overview"</a>. <i>GNU Compiler Collection (GCC) Internals</i>.</cite></span>
</li>
<li id="cite_note-3"><span class="mw-cite-backlink"><b><a href="#cite_ref-3">^</a></b></span> <span class="reference-text">Thomas C. Spillman, "Exposing side effects in a PL/I optimizing compiler", in <i>Proceedings of IFIPS 1971</i>, North-Holland Publishing Company, pages 376-381.</span>
</li>
<li id="cite_note-4"><span class="mw-cite-backlink"><b><a href="#cite_ref-4">^</a></b></span> <span class="reference-text">Frances E. Allen, "Interprocedural Data Flow Analysis", IFIPS Proceedings, 1974.</span>
</li>
<li id="cite_note-5"><span class="mw-cite-backlink"><b><a href="#cite_ref-5">^</a></b></span> <span class="reference-text">Frances E. Allen, and Jack Schwartz, "Determining the Data Flow Relationships in a Collection of Procedures", IBM Research Report RC 4989, Aug. 1974.</span>
</li>
<li id="cite_note-6"><span class="mw-cite-backlink"><b><a href="#cite_ref-6">^</a></b></span> <span class="reference-text"><a href="Philip_S._Abrams" title="Philip S. Abrams">Philip Abrams</a>, "An APL Machine", Stanford University Computer Science Department, Report STAN-CS-70-158, February, 1970.</span>
</li>
<li id="cite_note-7"><span class="mw-cite-backlink"><b><a href="#cite_ref-7">^</a></b></span> <span class="reference-text">Terrence C. Miller, "Tentative Compilation: A Design for an APL Compiler", Ph.D. Thesis, Yale University, 1978.</span>
</li>
<li id="cite_note-8"><span class="mw-cite-backlink"><b><a href="#cite_ref-8">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://clang.llvm.org/docs/ClangCommandLineReference.html">"Clang command line argument reference"</a>. <i>Clang 11 documentation</i>.</cite></span>
</li>
<li id="cite_note-9"><span class="mw-cite-backlink"><b><a href="#cite_ref-9">^</a></b></span> <span class="reference-text"><cite id="CITEREFReinhart" class="citation web cs1">Reinhart, Jonathan. <a rel="nofollow" class="external text" href="https://stackoverflow.com/a/48030735">"Can LTO for gcc or clang optimize across C and C++ methods"</a>. <i>Stack Overflow</i>.</cite></span>
</li>
<li id="cite_note-10"><span class="mw-cite-backlink"><b><a href="#cite_ref-10">^</a></b></span> <span class="reference-text"><cite id="CITEREFWoerister2019" class="citation web cs1">Woerister, Michael (19 September 2019). <a rel="nofollow" class="external text" href="http://blog.llvm.org/2019/09/closing-gap-cross-language-lto-between.html">"Closing the gap: cross-language LTO between Rust and C/C++"</a>. <i>LLVM Dev Blog</i>.</cite></span>
</li>
<li id="cite_note-11"><span class="mw-cite-backlink"><b><a href="#cite_ref-11">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html">"Optimize Options"</a>. <i>Using the GNU Compiler Collection (GCC)</i>.</cite></span>
</li>
<li id="cite_note-12"><span class="mw-cite-backlink"><b><a href="#cite_ref-12">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://elinux.org/Function_sections">"Function sections"</a>. <i>elinux.org</i>.</cite></span>
</li>
<li id="cite_note-13"><span class="mw-cite-backlink"><b><a href="#cite_ref-13">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://web.archive.org/web/20060921031008/http://www.tacc.utexas.edu/services/userguides/intel8/cc/c_ug/lin1149.htm">"Intel compiler 8 documentation"</a>. Archived from <a rel="nofollow" class="external text" href="http://www.tacc.utexas.edu/services/userguides/intel8/cc/c_ug/lin1149.htm">the original</a> on 2006-09-21<span class="reference-accessdate">. Retrieved <span class="nowrap">2007-02-13</span></span>.</cite></span>
</li>
<li id="cite_note-14"><span class="mw-cite-backlink"><b><a href="#cite_ref-14">^</a></b></span> <span class="reference-text">
<a rel="nofollow" class="external text" href="http://www.intel.com/cd/software/products/asmo-na/eng/compilers/fwin/278834.htm#Interprocedural_Optimization_(IPO)">Intel Visual Fortran Compiler 9.1, Standard and Professional Editions, for Windows* - Intel Software Network</a></span>
</li>
<li id="cite_note-MSVC_GL_2019-15"><span class="mw-cite-backlink"><b><a href="#cite_ref-MSVC_GL_2019_15-0">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://docs.microsoft.com/en-us/cpp/build/reference/gl-whole-program-optimization">"/GL (Whole Program Optimization)"</a>. <i>Microsoft Docs</i>. 2019-03-12<span class="reference-accessdate">. Retrieved <span class="nowrap">2020-01-26</span></span>.</cite></span>
</li>
<li id="cite_note-16"><span class="mw-cite-backlink"><b><a href="#cite_ref-16">^</a></b></span> <span class="reference-text"><cite class="citation web cs1"><a rel="nofollow" class="external text" href="https://cmake.org/cmake/help/latest/prop_tgt/INTERPROCEDURAL_OPTIMIZATION.html">"INTERPROCEDURAL_OPTIMIZATION"</a>. <i>CMake 3.17.2 Documentation</i>.</cite></span>
</li>
</ol></div>
<div class="mw-heading mw-heading2"><h2 id="External_links">External links</h2></div>
<ul><li><a rel="nofollow" class="external text" href="https://archive.today/20130112201318/http://www.futurechips.org/tips-for-power-coders/how-to-trick-cc-compilers-into-generating-terrible-code.html">How to trick C/C++ compilers into generating terrible code?</a></li></ul>
<div class="navbox-styles"><style data-mw-deduplicate="TemplateStyles:r1129693374">
/* start https://en.wikipedia.org/ */
.mw-parser-output .hlist dl,.mw-parser-output .hlist ol,.mw-parser-output .hlist ul{margin:0;padding:0}.mw-parser-output .hlist dd,.mw-parser-output .hlist dt,.mw-parser-output .hlist li{margin:0;display:inline}.mw-parser-output .hlist.inline,.mw-parser-output .hlist.inline dl,.mw-parser-output .hlist.inline ol,.mw-parser-output .hlist.inline ul,.mw-parser-output .hlist dl dl,.mw-parser-output .hlist dl ol,.mw-parser-output .hlist dl ul,.mw-parser-output .hlist ol dl,.mw-parser-output .hlist ol ol,.mw-parser-output .hlist ol ul,.mw-parser-output .hlist ul dl,.mw-parser-output .hlist ul ol,.mw-parser-output .hlist ul ul{display:inline}.mw-parser-output .hlist .mw-empty-li{display:none}.mw-parser-output .hlist dt::after{content:": "}.mw-parser-output .hlist dd::after,.mw-parser-output .hlist li::after{content:" · ";font-weight:bold}.mw-parser-output .hlist dd:last-child::after,.mw-parser-output .hlist dt:last-child::after,.mw-parser-output .hlist li:last-child::after{content:none}.mw-parser-output .hlist dd dd:first-child::before,.mw-parser-output .hlist dd dt:first-child::before,.mw-parser-output .hlist dd li:first-child::before,.mw-parser-output .hlist dt dd:first-child::before,.mw-parser-output .hlist dt dt:first-child::before,.mw-parser-output .hlist dt li:first-child::before,.mw-parser-output .hlist li dd:first-child::before,.mw-parser-output .hlist li dt:first-child::before,.mw-parser-output .hlist li li:first-child::before{content:" (";font-weight:normal}.mw-parser-output .hlist dd dd:last-child::after,.mw-parser-output .hlist dd dt:last-child::after,.mw-parser-output .hlist dd li:last-child::after,.mw-parser-output .hlist dt dd:last-child::after,.mw-parser-output .hlist dt dt:last-child::after,.mw-parser-output .hlist dt li:last-child::after,.mw-parser-output .hlist li dd:last-child::after,.mw-parser-output .hlist li dt:last-child::after,.mw-parser-output .hlist li li:last-child::after{content:")";font-weight:normal}.mw-parser-output .hlist ol{counter-reset:listitem}.mw-parser-output .hlist ol>li{counter-increment:listitem}.mw-parser-output .hlist ol>li::before{content:" "counter(listitem)"\a0 "}.mw-parser-output .hlist dd ol>li:first-child::before,.mw-parser-output .hlist dt ol>li:first-child::before,.mw-parser-output .hlist li ol>li:first-child::before{content:" ("counter(listitem)"\a0 "}
/* end https://en.wikipedia.org/ */
</style><style data-mw-deduplicate="TemplateStyles:r1236075235">
/* start https://en.wikipedia.org/ */
.mw-parser-output .navbox{box-sizing:border-box;border:1px solid #a2a9b1;width:100%;clear:both;font-size:88%;text-align:center;padding:1px;margin:1em auto 0}.mw-parser-output .navbox .navbox{margin-top:0}.mw-parser-output .navbox+.navbox,.mw-parser-output .navbox+.navbox-styles+.navbox{margin-top:-1px}.mw-parser-output .navbox-inner,.mw-parser-output .navbox-subgroup{width:100%}.mw-parser-output .navbox-group,.mw-parser-output .navbox-title,.mw-parser-output .navbox-abovebelow{padding:0.25em 1em;line-height:1.5em;text-align:center}.mw-parser-output .navbox-group{white-space:nowrap;text-align:right}.mw-parser-output .navbox,.mw-parser-output .navbox-subgroup{background-color:#fdfdfd}.mw-parser-output .navbox-list{line-height:1.5em;border-color:#fdfdfd}.mw-parser-output .navbox-list-with-group{text-align:left;border-left-width:2px;border-left-style:solid}.mw-parser-output tr+tr>.navbox-abovebelow,.mw-parser-output tr+tr>.navbox-group,.mw-parser-output tr+tr>.navbox-image,.mw-parser-output tr+tr>.navbox-list{border-top:2px solid #fdfdfd}.mw-parser-output .navbox-title{background-color:#ccf}.mw-parser-output .navbox-abovebelow,.mw-parser-output .navbox-group,.mw-parser-output .navbox-subgroup .navbox-title{background-color:#ddf}.mw-parser-output .navbox-subgroup .navbox-group,.mw-parser-output .navbox-subgroup .navbox-abovebelow{background-color:#e6e6ff}.mw-parser-output .navbox-even{background-color:#f7f7f7}.mw-parser-output .navbox-odd{background-color:transparent}.mw-parser-output .navbox .hlist td dl,.mw-parser-output .navbox .hlist td ol,.mw-parser-output .navbox .hlist td ul,.mw-parser-output .navbox td.hlist dl,.mw-parser-output .navbox td.hlist ol,.mw-parser-output .navbox td.hlist ul{padding:0.125em 0}.mw-parser-output .navbox .navbar{display:block;font-size:100%}.mw-parser-output .navbox-title .navbar{float:left;text-align:left;margin-right:0.5em}body.skin--responsive .mw-parser-output .navbox-image img{max-width:none!important}@media print{body.ns-0 .mw-parser-output .navbox{display:none!important}}
/* end https://en.wikipedia.org/ */
</style></div><div role="navigation" class="navbox" aria-labelledby="Compiler_optimizations253" style="padding:3px"><table class="nowraplinks mw-collapsible autocollapse navbox-inner" style="border-spacing:0;background:transparent;color:inherit"><tbody><tr><th scope="col" class="navbox-title" colspan="2"><style data-mw-deduplicate="TemplateStyles:r1239400231">
/* start https://en.wikipedia.org/ */
.mw-parser-output .navbar{display:inline;font-size:88%;font-weight:normal}.mw-parser-output .navbar-collapse{float:left;text-align:left}.mw-parser-output .navbar-boxtext{word-spacing:0}.mw-parser-output .navbar ul{display:inline-block;white-space:nowrap;line-height:inherit}.mw-parser-output .navbar-brackets::before{margin-right:-0.125em;content:"[ "}.mw-parser-output .navbar-brackets::after{margin-left:-0.125em;content:" ]"}.mw-parser-output .navbar li{word-spacing:-0.125em}.mw-parser-output .navbar a>span,.mw-parser-output .navbar a>abbr{text-decoration:inherit}.mw-parser-output .navbar-mini abbr{font-variant:small-caps;border-bottom:none;text-decoration:none;cursor:inherit}.mw-parser-output .navbar-ct-full{font-size:114%;margin:0 7em}.mw-parser-output .navbar-ct-mini{font-size:114%;margin:0 4em}html.skin-theme-clientpref-night .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}@media(prefers-color-scheme:dark){html.skin-theme-clientpref-os .mw-parser-output .navbar li a abbr{color:var(--color-base)!important}}@media print{.mw-parser-output .navbar{display:none!important}}
/* end https://en.wikipedia.org/ */
</style><div id="Compiler_optimizations253" style="font-size:114%;margin:0 4em"><a href="Optimizing_compiler" title="Optimizing compiler">Compiler optimizations</a></div></th></tr><tr><th scope="row" class="navbox-group" style="width:1%">Basic block</th><td class="navbox-list-with-group navbox-list navbox-odd hlist" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Peephole_optimization" title="Peephole optimization">Peephole optimization</a></li>
<li><a href="Local_value_numbering" class="mw-redirect" title="Local value numbering">Local value numbering</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="Loop_optimization" title="Loop optimization">Loop</a></th><td class="navbox-list-with-group navbox-list navbox-even hlist" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Automatic_parallelization" title="Automatic parallelization">Automatic parallelization</a></li>
<li><a href="Automatic_vectorization" title="Automatic vectorization">Automatic vectorization</a></li>
<li><a href="Induction_variable" title="Induction variable">Induction variable</a></li>
<li><a href="Loop_fusion" class="mw-redirect" title="Loop fusion">Loop fusion</a></li>
<li><a href="Loop-invariant_code_motion" title="Loop-invariant code motion">Loop-invariant code motion</a></li>
<li><a href="Loop_inversion" title="Loop inversion">Loop inversion</a></li>
<li><a href="Loop_interchange" title="Loop interchange">Loop interchange</a></li>
<li><a href="Loop_nest_optimization" title="Loop nest optimization">Loop nest optimization</a></li>
<li><a href="Loop_splitting" title="Loop splitting">Loop splitting</a></li>
<li><a href="Loop_unrolling" title="Loop unrolling">Loop unrolling</a></li>
<li><a href="Loop_unswitching" title="Loop unswitching">Loop unswitching</a></li>
<li><a href="Software_pipelining" title="Software pipelining">Software pipelining</a></li>
<li><a href="Strength_reduction" title="Strength reduction">Strength reduction</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="Data-flow_analysis" title="Data-flow analysis">Data-flow<br>analysis</a></th><td class="navbox-list-with-group navbox-list navbox-odd hlist" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Available_expression" title="Available expression">Available expression</a></li>
<li><a href="Common_subexpression_elimination" title="Common subexpression elimination">Common subexpression elimination</a></li>
<li><a href="Constant_folding" title="Constant folding">Constant folding</a></li>
<li><a href="Dead_store" title="Dead store">Dead store</a> elimination</li>
<li><a href="Induction_variable_recognition_and_elimination" class="mw-redirect" title="Induction variable recognition and elimination">Induction variable recognition and elimination</a></li>
<li><a href="Live-variable_analysis" title="Live-variable analysis">Live-variable analysis</a></li>
<li><a href="Upwards_exposed_uses" title="Upwards exposed uses">Upwards exposed uses</a></li>
<li><a href="Use-define_chain" title="Use-define chain">Use-define chain</a></li>
<li><a href="Reaching_definition" title="Reaching definition">Reaching definitions</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="Static_single-assignment_form" title="Static single-assignment form">SSA</a>-based</th><td class="navbox-list-with-group navbox-list navbox-even hlist" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Global_value_numbering" class="mw-redirect" title="Global value numbering">Global value numbering</a></li>
<li><a href="Sparse_conditional_constant_propagation" title="Sparse conditional constant propagation">Sparse conditional constant propagation</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%"><a href="Code_generation_(compiler)" title="Code generation (compiler)">Code generation</a></th><td class="navbox-list-with-group navbox-list navbox-odd hlist" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Instruction_scheduling" title="Instruction scheduling">Instruction scheduling</a></li>
<li><a href="Instruction_selection" title="Instruction selection">Instruction selection</a></li>
<li><a href="Register_allocation" title="Register allocation">Register allocation</a></li>
<li><a href="Rematerialization" title="Rematerialization">Rematerialization</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Functional</th><td class="navbox-list-with-group navbox-list navbox-even hlist" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Deforestation_(computer_science)" title="Deforestation (computer science)">Deforestation</a></li>
<li><a href="Tail_call" title="Tail call">Tail-call elimination</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Global</th><td class="navbox-list-with-group navbox-list navbox-odd hlist" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Other</th><td class="navbox-list-with-group navbox-list navbox-even hlist" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Bounds-checking_elimination" title="Bounds-checking elimination">Bounds-checking elimination</a></li>
<li><a href="Compile-time_function_execution" title="Compile-time function execution">Compile-time function execution</a></li>
<li><a href="Dead-code_elimination" title="Dead-code elimination">Dead-code elimination</a></li>
<li><a href="Expression_templates" title="Expression templates">Expression templates</a></li>
<li><a href="Inline_expansion" title="Inline expansion">Inline expansion</a></li>
<li><a href="Jump_threading" title="Jump threading">Jump threading</a></li>
<li><a href="Partial_evaluation" title="Partial evaluation">Partial evaluation</a></li>
<li><a href="Profile-guided_optimization" title="Profile-guided optimization">Profile-guided optimization</a></li></ul>
</div></td></tr><tr><th scope="row" class="navbox-group" style="width:1%">Static analysis</th><td class="navbox-list-with-group navbox-list navbox-odd hlist" style="width:100%;padding:0"><div style="padding:0 0.25em">
<ul><li><a href="Alias_analysis" title="Alias analysis">Alias analysis</a></li>
<li><a href="Array-access_analysis" title="Array-access analysis">Array-access analysis</a></li>
<li><a href="Control-flow_analysis" title="Control-flow analysis">Control-flow analysis</a></li>
<li><a href="Data-flow_analysis" title="Data-flow analysis">Data-flow analysis</a></li>
<li><a href="Dependence_analysis" title="Dependence analysis">Dependence analysis</a></li>
<li><a href="Escape_analysis" title="Escape analysis">Escape analysis</a></li>
<li><a href="Pointer_analysis" title="Pointer analysis">Pointer analysis</a></li>
<li><a href="Shape_analysis_(program_analysis)" title="Shape analysis (program analysis)">Shape analysis</a></li>
<li><a href="Value_range_analysis" title="Value range analysis">Value range analysis</a></li></ul>
</div></td></tr></tbody></table></div></div><!--htdig_noindex--><div><div class="zim-footer">
This article is issued from <a class="external text" title="Last edited on 2025-02-26" href="https://en.wikipedia.org/wiki/?title=Interprocedural_optimization&oldid=1277758331">Wikipedia</a>. The text is available under <a class="external text" href="https://creativecommons.org/licenses/by-sa/4.0/deed.en">Creative Commons Attribution-Share Alike 4.0</a> unless otherwise noted. Additional terms may apply for the media files.
</div>
</div><!--/htdig_noindex--></div>
</div>
</main>
</div>
</div>
</div>
</body></html>